package com.sailfish.springbootdemo.controller.db1;

import com.sailfish.springbootdemo.pojo.Result;
import com.sailfish.springbootdemo.pojo.db1.LineLevel;
import com.sailfish.springbootdemo.service.db1.LineLevelService;
import com.sailfish.springbootdemo.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/lineLevel")
@CrossOrigin
public class LineLevelController {

    @Autowired
    private LineLevelService lineLevelService;

    @PostMapping("/getAllLineLevel")
    public Result getAllLineLevel() {
        try {
            return ResultUtil.success(lineLevelService.getAllLineLevel());
        } catch (Exception e) {
            e.printStackTrace();
            return ResultUtil.error(500, e.getMessage(), e.getMessage(), null);
        }
    }
}
